// JavaScript Document
define(function(require, exports, module) {
	var Masker = function() {
	}
	Masker.prototype.element=null;
	Masker.prototype.opened=false;
	
	Masker.prototype.create = function() {
		this.element = document.createElement("div")
		this.element.className = "ht_masker close"
		document.body.appendChild(this.element)
	}
	Masker.prototype.setElement = function(element) {
		this.element=element;
		this.opened=true;
	}
	Masker.prototype.hide = function() {
		this.element.style.display="none";
	}
	Masker.prototype.open = function() {
		if(this.opened==true){
			return false;
		}
		var self = this;
		if(this.element==null){
			this.create();
		}
		setTimeout(function() {
			self.element.className = "ht_masker open"
		}, 0)
		this.opened=true;
	}
	
	
	
	
	
	
	Masker.prototype.close = function() {
		if(this.opened==false){
			return false;
		}
		var self = this;
		if(this.element!=null){
			this.element.className = "ht_masker close"
			var timer = setTimeout(function() {self.remove();self.opened=false;}, 200);
		}
	}
	Masker.prototype.remove = function() {
		$(this.element).remove();
		
		//this.element.parentNode.removeChild(this.element)
		this.element=null;
		//document.body.removeChild(this.element)
	}
	module.exports = Masker;
});